package Controleur;

import Vue.AppletFenetre;
import Vue.Scores;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

/**
 * Impl�mente ActionListener. Contient les differentes m�thodes � appeler en
 * fonction des actions sur le JPanel Scores.
 */
public class ScoresListener implements ActionListener {

    private AppletFenetre applet;
    private Scores score;

    public ScoresListener(AppletFenetre applet) {
        this.applet = applet;
        score = applet.getScore();
    }

    /**
     *
     * @param e
     */
    @Override
    public void actionPerformed(ActionEvent e) {
        if (e.getActionCommand().equals("Accueil")) {
            applet.getCardLayout().show(applet.getContent(), applet.getListContent()[0]);
        }
        if (e.getActionCommand().equals("Scores")) {
            applet.getScore().afficherScores("qcm.txt");
            applet.getScore().afficherScores("tat.txt");
            applet.getScore().revalidate();
            applet.getCardLayout().show(applet.getContent(), applet.getListContent()[2]);
        }
    }
}